[C# .NET6] AutoFac ADD implementation after DI Container Resolve


If you want to Add a implementation after DI Container resolved already,
you need to create a newBuilder and Update it to the original Container.

                var newBuilder = new ContainerBuilder();
                newBuilder.Register(c =>  new Car {Seats = GetSeats().Split(',') }).As<ICar>();
                newBuilder.Update(OriginalDIContainer);
#C# #.net6 #.net






你可能感興趣的文章

12. Flyweight

12. Flyweight

React 基礎

React 基礎

[ CSS 03 ]  盒模型(box model)與定位(position)

[ CSS 03 ] 盒模型(box model)與定位(position)






留言討論